﻿using HamcoWcs.Models.Common;
using System;
using System.Collections.Generic;

namespace HamcoWcs.Models.Logs
{
    public class DeviceMsgLogDto
    {
        public string PlcName { get; set; }
        public string DeviceName { get; set; }
        public string TaskId { get; set; }
        public string UnitId { get; set; }
        public string MsgValue { get; set; }
        public string Direction { get; set; }
        public DateTime CreatedTime { get; set; }


        private static DeviceMsgLogDto CreateLog(string plcName, string deviceName, string unitId, string msgValue, string direction)
            => new DeviceMsgLogDto()
            {
                PlcName = plcName,
                DeviceName = deviceName,
                UnitId = unitId,
                MsgValue = msgValue,
                Direction = direction
            };

        public static DeviceMsgLogDto CreatSendLog(string plcName, string deviceName, string unitId, string msgValue, string direction)
            => CreateLog(plcName, deviceName, unitId, msgValue, direction);

        //public static DeviceMsgLogDto CreatSendLog()

        public static DeviceMsgLogDto CreatRecvLog(string plcName, string deviceName, string unitId, string msgValue)
            => CreateLog(plcName, deviceName, unitId, msgValue, "recv");
    }

    public class QueryDeviceMsgLog : PageSizeTime
    {
        public string PlcName { get; set; }
        public string DeviceName { get; set; }
        public string TaskId { get; set; }
        public string UnitId { get; set; }
        public string MsgValue { get; set; }
        public string Direction { get; set; }
    }
}
